//
//  LS_BaseNavViewController.m
//  breadPro
//
//  Created by 刘文超 on 2019/7/5.
//  Copyright © 2019 刘文超. All rights reserved.
//

#import "LS_BaseNavViewController.h"
#import "UIBarButtonItem+LS_BarButtonCustom.h"
@interface LS_BaseNavViewController ()

@end

@implementation LS_BaseNavViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [self setUpNavigationBarAppearance];
    if (self.viewControllers.count>0) {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.fd_interactivePopMaxAllowedInitialDistanceToLeftEdge = CGRectGetWidth(([UIScreen mainScreen].bounds))/3;
        [self setCustomNavBarWithViewController:viewController];
    }
    [super pushViewController:viewController
                     animated:animated];
}
-(void)setCustomNavBarWithViewController:(UIViewController *)viewController
{
    UIBarButtonItem *item = [UIBarButtonItem itemWithTarget:self action:@selector(BtnLeftClick) image:@"icon_nav_back_white_19x18_" selectImage:@"icon_nav_back_white_19x18_"];
    viewController.navigationItem.leftBarButtonItem = item;
}
-(void)BtnLeftClick
{
    [self popViewControllerAnimated:YES];
}
#pragma mark -
#pragma mark -----设置全局的导航栏属性
-(void)setUpNavigationBarAppearance
{
    UINavigationBar *navBarAppearance = [UINavigationBar appearance];
    NSDictionary *texteAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont fontWithName:@"Noteworthy-Bold" size:18]};
    navBarAppearance.tintColor = [UIColor whiteColor];
    [navBarAppearance setTitleTextAttributes:texteAttributes];
    navBarAppearance.barTintColor = LS_SetColor(80, 189, 203);
    
}

@end
